/*
 * NewJavaFXStage.fx
 *
 * Created on 04.12.2009, 16:26:28
 */

package javafx179labs.mikhalin.lab4;

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.image.ImageView;
import javafx.scene.image.Image;
import javafx.scene.Node;
import java.lang.Integer;
import javafx.scene.input.MouseEvent;
import javafx.scene.transform.Scale;

import javafx.animation.Timeline;

/**
 * @author Asus
 */

 var gam : ImageView[];
 var ny: Integer = 0;
 var i: Number = 1;

gam[0] = ImageView {
        x: 250
        y: 350
        transforms: Scale { x : bind i, y : bind i, pivotX: 315, pivotY: 400  }
        onMouseClicked: function( e: MouseEvent ):Void {
                  anim.play();
                }               
         image: Image {
                 url: "{__DIR__}Gam8.png"
         }
 }

gam[1] = ImageView {
         x: 240
         y: bind ny*0.2 + 300
         image: Image {
                 url: "{__DIR__}Gam7.png"
         }
 }

gam[2] = ImageView {
         x: 260
         y: bind ny*0.35 + 285
         image: Image {
                 url: "{__DIR__}Gam6.png"
         }
 }

 gam[3] = ImageView {
        x: 260
        y: bind ny*0.5 + 270
         image: Image {
                 url: "{__DIR__}Gam5.png"
         }
 }

gam[4] = ImageView {

         x: 260
         y: bind ny*0.65 + 260
         image: Image {
                 url: "{__DIR__}Gam4.png"
         }
 }

 gam[5] = ImageView {
            x: 260
            y: bind ny*0.8 + 240

         image: Image {
                 url: "{__DIR__}Gam3.png"
         }
 }

gam[6] = ImageView {
           x: 260
           y: bind ny*0.95 + 225

         image: Image {
                 url: "{__DIR__}Gam2.png"
         }
 }

gam[7] = ImageView {
         x: 260
         y: bind ny*1.1 + 210
        
         image: Image {
                 url: "{__DIR__}Gam1.png"
         }
 }

var anim = Timeline {
                autoReverse: true
                repeatCount: 500
                keyFrames : [
                        at(0s) {i => 1.2}
                        at(250ms) {ny => -50;i => 1}
                        at(500ms) {ny => -75}
                        at(750ms) {ny => -90}
                        at(1000ms) {ny => -100}
                ]
        }

 var SceneContent: Node[] = [gam];

Stage {
    title: "Application title"
    width: 640
    height: 480
    scene: Scene {
        content: bind SceneContent
    }
}